<!DOCTYPE html>
<html lang="zh-CN">
<html lang="en">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./index.css">
</head>

<body>
    <title>侧边栏</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            background-color: pink;
        }
        .sidebar{
            width: 600px;
            height: 100%;
            position: absolute;
            top: 0;
            right: -600px;
            background-color: skyblue;
        }
        .active{
            transform: translateX(-600px);
            transition: all 3s;
        }
    </style>
</head>
<body>
    <div id="app">
        <button v-on:click="btn">点击</button>

        <div class="sidebar" v-bind:class="obj"> </div>
    </div>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                // isShow:{}
                obj:{
                    active:false
                }
            },
            methods:{
               btn:function(){
                   this.obj.active = !this.obj.active;
               }
            },
            
        })
    </script>
</body>
</html>